package regex_tester;

import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
	private static final Pattern discoveredPattern = Pattern.compile("<([^:\\s]+):(\\d+)>");//(:)(\\d*)
	private static String testString = "test > 0 sadfsd < 6 TRANSITION STATISTICS"+
 "\n <T0:1>, <T1:2>, <T2:1>, <T3:3>, <T4:0>, <T5:0> " +
 "\n <T6:5>, <T7:1>, <T8:3>";
	private static HashMap<String,Integer> transitionStats = new HashMap<String, Integer>();
	public static void main(String[] args) {
		System.out.println(testString);
		Matcher matcher = discoveredPattern.matcher(testString);
		while (matcher.find()) {
			transitionStats.put(matcher.group(1), Integer.parseInt(matcher.group(2)));
			for (int i=0;i<=matcher.groupCount();i++) {
				String value = matcher.group(i);
				System.out.println(value);				
			}
//			String value = matcher.group(2);
//			System.out.println(value);
		}
		System.out.println(testString);
	}
}
